import { Action, Actor } from 'iflux2'
import { orderTypes } from '../constant/actionTypes.js'
export default class OrderActor extends Actor {
    defaultState (){
        return {
            order:{
                itemList:[],
                state:1,
                applyRefund:0,
                userLogo:''
            }
        }
    }

    @Action(orderTypes.SET_ORDER)
    setOrder(state,order){
        return state.set('order', order);
    }

    @Action(orderTypes.CHANGE_DATA)
    changeOrder(state,dt){
        return state.update('order',order=>order.merge(dt))
    }

    @Action(orderTypes.SET_USER_LOGO)
    setUserLogo(state,logo){
        return state.update('order',order => order.set('userLogo',logo))
    }
}